<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simSetVisionSensorImage</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simSetVisionSensorImage" id="simSetVisionSensorImage"></a>simSetVisionSensorImage / sim.setVisionSensorImage</h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Sets the rgb-image of a vision sensor (and applies any image processing via the <a href="../visionCallbackFunctions.htm">vision callback functions</a>). Make sure the vision sensor is flagged as <strong>external input</strong>. Use <a href="simGetVisionSensorResolution.htm">sim.getVisionSensorResolution</a> to know the size of the image buffer that you need to provide (buffer size=resolutionX *resolutionY*3).  See also <a href="simSetVisionSensorCharImage.htm">sim.setVisionSensorCharImage</a>.</td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simSetVisionSensorImage(simInt sensorHandle,const simFloat* image)</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>sensorHandle</strong>: handle of the vision sensor object. Can be combined with <a href="../apiConstants.htm#specialHandleFlags">sim_handleflag_greyscale</a> (simply add sim_handleflag_greyscale to sensorHandle if you provide grey scale values instead of rgb value) or/and <a href="../apiConstants.htm#specialHandleFlags">sim_handleflag_rawvalue</a> (simply add sim_handleflag_rawvalue to sensorHandle if you do not wish to trigger image processing). If you instead want to set the vision sensor depth buffer, you can combine the handle of the vision sensor object with <a href="../apiConstants.htm#specialHandleFlags">sim_handleflag_depthbuffer</a>.</div>
<div><strong>image</strong>: rgb buffer containing the image (buffer size must be resolutionX*resolutionY*3). Values in the buffer should vary between 0 and 1. In case a grey scale image is provided, the buffer size must be resolutionX*resolutionY. In case sim_handleflag_depthbuffer is specified, then the buffer size must be resolutionX*resolutionY.</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 if operation was not successful. 0 if the image processing didn't trigger anything, 1 if the image processing triggered a detection<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn> <div> (1) number result=sim.setVisionSensorImage(number sensorHandle,table image) </div>
<div> (2) number result=sim.setVisionSensorImage(number sensorHandle,string image)</div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div><strong>sensorHandle</strong>: handle of the vision sensor object. Can be combined with <a href="../apiConstants.htm#specialHandleFlags">sim.handleflag_greyscale</a> (simply add sim.handleflag_greyscale to sensorHandle if you provide grey scale values instead of rgb value) or/and <a href="../apiConstants.htm#specialHandleFlags">sim.handleflag_rawvalue</a> (simply add sim.handleflag_rawvalue to sensorHandle if you do not wish to trigger image processing). If you instead want to set the vision sensor depth buffer, you can combine the handle of the vision sensor object with <a href="../apiConstants.htm#specialHandleFlags">sim_handleflag_depthbuffer</a>.</div>
<div>(1) a table containing individual values [0-1] for the red, green and blue components, or for the grey component. In case sim_handleflag_depthbuffer is specified, the table contains depth values.</div>
<div>(2) a string containing individual chars [0-255] for the red, green and blue components, or for the grey component. In case sim_handleflag_depthbuffer is specified, the string is a coded string (i.e. a packed depth value table).</div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 

<tr class=apiTableTr> 
<td class=remApiTableLeftCParam>
Remote API equiv.
</td> 
<td class=remApiTableRightCParam>
<div>B0-based remote API: <a href="../b0RemoteApi-cpp.htm#simxSetVisionSensorImage">simxSetVisionSensorImage</a></div>
<div>Legacy remote API: <a href="../remoteApiFunctions.htm#simxSetVisionSensorImage">simxSetVisionSensorImage</a></div>
</td> 
</tr> 

</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
